package com.itfreer.knowledge.service.config;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.itfreer.form.api.BaseDao;
import com.itfreer.form.api.imp.DictionaryServiceImp;
import com.itfreer.form.dictionary.base.DictionaryItem;
import com.itfreer.knowledge.dao.config.SiteDao;
import com.itfreer.knowledge.entity.config.SiteEntity;

/**
 * 定义站点管理服务实现类
 */
@Component("knowledgeSiteServiceImp")
public class SiteServiceImp extends DictionaryServiceImp<SiteEntity> implements SiteService {

	@Autowired
	private SiteDao siteDao;
	
	@Override
	public String getDictionaryName() {
		return "knowledge_site";
	}

	@Override
	protected DictionaryItem convert(SiteEntity entity) {
		DictionaryItem toEntity = new DictionaryItem();
		BeanUtils.copyProperties(entity, toEntity);
		toEntity.getOther().put("organizationId", entity.getOrganizationId());
		return toEntity;
	}

	@Override
	protected String getDictionaryFields() {
		return "id,pid,code,display,valid,leaf,organizationId";
	}

	@Override
	protected BaseDao<SiteEntity> getDao() {
		return siteDao;
	}
}